package com.indusfo.spc.pda.mapper;

import com.indusfo.spc.pda.pojo.OrderAndMatDto;
import com.indusfo.spc.pda.pojo.OrderDosing;
import com.indusfo.spc.pojo.Order;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface OrderDosingMapper {
    int deleteByPrimaryKey(Integer orderDosingId);

    int insert(OrderDosing record);

    int insertSelective(OrderDosing record);

    OrderDosing selectByPrimaryKey(Integer orderDosingId);

    int updateByPrimaryKeySelective(OrderDosing record);

    int updateByPrimaryKey(OrderDosing record);

    /**
     * 通过产线id和发布日期查询生产任务单 物料 和批次数量
     * @param order
     * @return
     */
    List<OrderAndMatDto> queryOrderAndMat(Order order);

    /**
     * 通过产线id和发布日期查询生产任务单 物料 和批次数量 计数
     * @param order
     * @return
     */
    int countQueryOrderAndMat(Order order);

    /**
     * 查询任务单叫料信息
     * @param orderDosing
     * @return
     */
    List<OrderDosing> queryOrderDosingList(OrderDosing orderDosing);

    /**
     * 通过任务单id查询任务单叫料信息
     * @param orderDosing
     * @return
     */
    @MapKey("matId")
    Map<String,OrderDosing> queryOrderDosingByOrderId(OrderDosing orderDosing);
    /**
     * 计数
     * @param orderDosing
     * @return
     */
    int countQueryOrderDosingList(OrderDosing orderDosing);

    /**
     * 更新任务单叫料的叫料状态
     * @param orderDosingId
     * @return
     */
    int updateDosingState(@Param("orderDosingId") Integer orderDosingId);
}